﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using YQLDataProvider;

namespace DataProvidersUnitTest.YqlDataProviderTests
{
    [TestClass]
    public class SettingsFactoryTests
    {
        private const string TestBaseUri = "http://query.yahooapis.com/v1/public/yql";
        private const string TestPostfix = "env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys";
        
        [TestMethod]
        public void SettingFactoryCreateSetting_FromConfig_Success()
        {
            //GIVEN
            const string expectedTableName = "yahoo.finance.industry";
            var target = new SettingsFactory();
            //WHEN
            var settings = target.CreateSettings("industries");
            //THEN
            Assert.AreEqual(TestBaseUri, settings.BaseUri);
            Assert.AreEqual(TestPostfix, settings.Postfix);
            Assert.IsTrue(settings.IsExtensionsTableIncluded);
            Assert.AreEqual(expectedTableName, settings.TableName);
        }
    }
}
